package com.lnu.information.exception;

/**
 * @author : jian.zhang-2
 * @description:
 * @date : Create in 3:55 PM 2022/3/10
 * @modified By :
 */
public class QueryException extends BaseException {

    protected QueryException(String defineCode) {
        super(defineCode);
    }

    /**
     * 通过异常可以获取code与message
     * @param code
     * @param message
     */
    public QueryException(String code, String message) {
        super(code);
        super.message = message;
    }


    /**
     * 通过异常可以获取code与message
     * @param tradeExceptionEnum
     */
    public QueryException(QueryExceptionEnum tradeExceptionEnum) {
        super(tradeExceptionEnum.getCode());
        super.message = tradeExceptionEnum.getMessage();
    }


    public QueryException newInstance(String msg, Object... args) {
        QueryException re = new QueryException(defineCode);
        re.setMessage(msg, args);
        return re;
    }

    public QueryException newInstance(QueryExceptionEnum tradeExceptionEnum, Object... args) {
        QueryException re = new QueryException(tradeExceptionEnum.getCode());
        re.setMessage(tradeExceptionEnum.getMessage(), args);
        return re;
    }


    public enum QueryExceptionEnum{

        CREATE_OPR_ORDER_EXCEPTION ("10001","调用交易下单接口异常"),
        FACADE_CALL_EXCEPTION ("10002","接口调用异常"),
        ILLEGAL_PARAM_EXCEPTION ("10003","请求参数不合法"),
        WRONG_APPKEY_EXCEPTION ("10004","appKey不合法"),
        DATA_NOT_EXIST_EXCEPTION ("10005","所查数据不存在"),
        TABLE_NOT_EXIST ("10006","表名不存在"),
        MERCHANT_PRODUCT_EXCEPTION ("10007","商户产品不合法"),
        TRADE_ORDER_NULL_EXCEPTION ("10008","该交易不存在"),
        TRADE_TIME_OUT_EXCEPTION ("10009","该交易已超时"),
        TRADE_ORDER_STATUS_EXCEPTION ("10010","交易订单状态异常"),
        PAY_ORDER_STATUS_EXCEPTION ("10011","交易订单正在支付"),
        BANKCARD_CANNOT_RECOGNIZE_EXCEPTION ("10012","银行卡不能识别"),
        TRADE_ORDER_NOT_SUCCESS_EXCEPTION ("10013","原交易订单未成功"),
        PAYMENT_ORDER_NOT_EXIST_EXCEPTION ("10014","支付订单不存在"),
        ORDER_REMITTED_EXCEPTION ("10015","原交易订单存在出款记录"),
        RECUR_REFUND_EXCEPTION ("10016","不能重复退款"),
        REFUND_DETAIL_NULL_EXCEPTION ("10017","退款信息不存在"),
        TIME_FORMAT_EXCEPTION ("10018","时间格式异常"),
        CREATE_PAY_EXCEPTION ("10019","支付预下单异常"),
        DATA_BASE_EXCEPTION ("10020","数据库异常"),
        SEND_SMS_EXCEPTION ("10021","发送短信失败"),
        ASYN_PAY_CONFIRM_EXCEPTION ("10022","支付确认失败"),
        PAYMENT_ORDER_TOO_MANY_EXCEPTION ("10023","重复支付"),
        PAYMENT_ORDER_STATUS_EXCEPTION ("10024","支付订单状态异常"),
        NOTIFY_ORDER_AMOUNT_EXCEPTION ("10025","交易金额与通知金额不一致"),
        NOTIFY_ORDER_SUCCESS_EXCEPTION ("10026","通知交易已成功"),
        NOTIFY_ORDER_CLOSED_EXCEPTION ("10027","通知交易已关闭"),
        QUERY_PAY_STATUS_PROCESS_EXCEPTION ("10028","支付确认超时"),
        QUERY_OPR_ORDER_EXCEPTION ("10029","调用opr交易订单查询接口异常"),
        SEND_PP_SMS_EXCEPTION ("10030","调用pp发送短信接口异常"),
        PP_CONFIRM_PAY_EXCEPTION ("10031","调用异步支付确认接口异常"),
        UPDATE_SUCCESS_STATUS_EXCEPTION ("10032","更新支付为成功状态异常"),
        AMOUNT_NOT_EQUALS_EXCEPTION ("10033","待支付金额与交易金额不一致"),
        TRADE_ORDER_SUCCESS_EXCEPTION ("10034","交易订单已成功"),
        TRADE_ORDER_CLOSED_EXCEPTION ("10035","交易订单已关闭"),
        PAY_PROCESSOR_REDIRECT_EXCEPTION ("10036","调用pp接口异常,需要跳转页面"),
        PAY_PROCESSOR_OTHER_EXCEPTION ("10037","调用pp接口异常,需要报错"),
        MERCHANT_RELATION_NOT_EXIST ("10038","商户关系不存在"),
        PART_REFUND_EXCEPTION ("10039","不允许部分退款"),
        SCENE_TYPE_EXCEPTION ("10040","场景类型有误"),
        REFUND_TIME_EXCEPTION ("10041","退款时间异常"),
        TRADE_NOT_BELONG_TO_MERCHANT_EXCEPTION ("10042","交易订单不属于该商户"),
        REPEAT_MERCHANT_REQUEST_NO_EXCEPTION ("10043","重复请求号"),
        MERCHANT_NO_STAGE ("10044","当前商户没有支持的分期信息"),
        ZERO_STAGE_NOT_OPEN ("10045","0期通道未开通"),
        SUB_TRADE_ORDER_NOT_EXIST ("10046","子订单号不存在"),
        TRADE_CHANNEL_NOT_EXIST_EXCEPTION ("10047","通道不存在"),
        CREATE_YMF_ORDER_EXCEPTION ("10048","调用易码付交易下单接口异常"),
        SEND_YMF_SEND_SMS_EXCEPTION ("10049","调用易码付发送短信接口异常"),
        YMF_CONFIRM_PAY_EXCEPTION ("10050","调用易码付异步支付确认接口异常"),
        TRADE_ORDER_INSTALMENT_COUNT_EXCEPTION ("10051","交易下单分期期数异常"),
        TRADE_ORDER_BANK_CODE_EXCEPTION ("10052","交易下单银行异常"),

        SYSTEM_EXCEPTION ("99999","系统异常");

        private String code;

        private String message;

        QueryExceptionEnum(String code, String message) {
            this.code = code;
            this.message = message;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }
    }
}
